import React from "react";


function fn(Com) {
  return ({ count, num, list }) => {
    // 第二个参数
    return (newCount) => {
      return class NewCom extends React.Component{
        state = {
          count,
          num,
          list
        }
        add = () => {
          this.setState({
            // eslint-disable-next-line react/no-direct-mutation-state
            count:this.state.count += newCount
          })
        }
        render() {
          const { count,num } = this.state
          return <div>
           {/* 相当于容器只展示返回的组件，Com不展示 */}
            <Com count={count} num={num} add ={this.add}/>
          </div>
        }
       }
     }
   }
}

export {
   fn
}